package com.pojo;

import cn.hutool.Hutool;
import cn.hutool.core.util.IdUtil;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;

import java.io.Serializable;

public class MyID  implements  org.hibernate.id.IdentifierGenerator {
    @Override
    public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException {
        Long id = IdUtil.getSnowflake(1,1).nextId();
        return id;
    }

    @Override
    public boolean supportsJdbcBatchInserts() {
        return false;
    }
}
